package cn.edu.scau.cmi.tangqingning.simpleSingleton;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class SimpleSingletonController {

	@FXML
    private TextArea textArea;

    @FXML
    private TextField textField;

    Chaiman chaiman;
    @FXML
    void onCreateClick(ActionEvent event) {
    	chaiman = Chaiman.getInstance(this.textField.getText());
    	System.out.println("当前主席是：" + chaiman.getName());

    }

    @FXML
    void onShowClick(ActionEvent event) {
    	if(chaiman != null) {
    		this.textArea.setText("当前主席是：" + chaiman.getName());
    	} else {
    		this.textArea.setText("当前无主席");
    	}
    }
}

